package com.ihome.android.market2.info;

import android.os.Parcel;
import android.os.Parcelable;

public class ProductInfo implements Parcelable {
	/** 产品编号 */
	private String	productID;
	/** 产品或节目名称 */
	private String	productName;
	/**
	 * 产品标识 0：定购产品 1：频道产品(暂停使用) 2：系统产品 3：增值产品 4：会议产品 5：游戏产品 9：节目
	 */
	private int		productFlag;
	/** SP编码 过滤订购关系列表，通过配置指定SPID返回所有厂商的订购关系 */
	private String	SPID;
	/** 本定购关系的鉴权失效时间，用绝对时间表示。格式为：YYYYMMDDHHMISS。如本参数为空，则表示该定购关系的鉴权长期有效 */
	private String	expiredTime;
	/**
	 * 0：包月 1：按次 2：包时段 3：固定有效期
	 */
	private int		purchaseType;
	/**
	 * 计费信息描述
	 */
	private String	changingPolicyDesc;
	/**
	 * 是否自动续定 0：是 1：否
	 */
	private int		subscriptionExtend;
	/**
	 * 服务编号
	 */
	private String	serviceID;

	private double		price;

	private double	productPrice;
	private int		productType;
	private String	transactionID;
	private int		userIDType;
	private String	userId;
	private String	packageName;

	public ProductInfo(String productID, int purchaseType) {
		this.productID = productID;
		this.purchaseType = purchaseType;
	}

	@Override
	public String toString() {
		StringBuffer sb = new StringBuffer();
		sb.append("productID            = ").append(productID).append("\n");
		sb.append("productName          = ").append(productName).append("\n");
		sb.append("productFlag          = ").append(productFlag).append("\n");
		sb.append("productType          = ").append(productType).append("\n");
		sb.append("productPrice         = ").append(productPrice).append("\n");
		sb.append("price                = ").append(price).append("\n");
		sb.append("SPID                 = ").append(SPID).append("\n");
		sb.append("expiredTime          = ").append(expiredTime).append("\n");
		sb.append("purchaseType         = ").append(purchaseType).append("\n");
		sb.append("changingPolicyDesc   = ").append(changingPolicyDesc).append("\n");
		sb.append("subscriptionExtend   = ").append(subscriptionExtend).append("\n");
		sb.append("serviceID            = ").append(serviceID).append("\n");
		sb.append("transactionID        = ").append(transactionID).append("\n");
		sb.append("userIDType           = ").append(userIDType).append("\n");
		sb.append("userId               = ").append(userId).append("\n");
		sb.append("packageName          = ").append(packageName).append("\n");
		return sb.toString();
	}

	public String getProductID() {
		return productID;
	}

	public void setProductID(String productID) {
		this.productID = productID;
	}

	public String getProductName() {
		return productName;
	}

	public void setProductName(String productName) {
		this.productName = productName;
	}

	public int getProductFlag() {
		return productFlag;
	}

	public void setProductFlag(int productFlag) {
		this.productFlag = productFlag;
	}

	public String getSPID() {
		return SPID;
	}

	public void setSPID(String sPID) {
		SPID = sPID;
	}

	public String getExpiredTime() {
		return expiredTime;
	}

	public void setExpiredTime(String expiredTime) {
		this.expiredTime = expiredTime;
	}

	public int getPurchaseType() {
		return purchaseType;
	}

	public void setPurchaseType(int purchaseType) {
		this.purchaseType = purchaseType;
	}

	public String getChangingPolicyDesc() {
		return changingPolicyDesc;
	}

	public void setChangingPolicyDesc(String changingPolicyDesc) {
		this.changingPolicyDesc = changingPolicyDesc;
	}

	public int getSubscriptionExtend() {
		return subscriptionExtend;
	}

	public void setSubscriptionExtend(int subscriptionExtend) {
		this.subscriptionExtend = subscriptionExtend;
	}

	public String getServiceID() {
		return serviceID;
	}

	public void setServiceID(String serviceID) {
		this.serviceID = serviceID;
	}

	public double getPrice() {
		return price;
	}

	public void setPrice(double price) {
		this.price = price;
	}

	public double getProductPrice() {
		return productPrice;
	}

	public void setProductPrice(double productPrice) {
		this.productPrice = productPrice;
	}

	public int getProductType() {
		return productType;
	}

	public void setProductType(int productType) {
		this.productType = productType;
	}

	public String getTransactionID() {
		return transactionID;
	}

	public void setTransactionID(String transactionID) {
		this.transactionID = transactionID;
	}

	public int getUserIDType() {
		return userIDType;
	}

	public void setUserIDType(int userIDType) {
		this.userIDType = userIDType;
	}

	public String getUserId() {
		return userId;
	}

	public void setUserId(String userId) {
		this.userId = userId;
	}

	public String getPackageName() {
		return packageName;
	}

	public void setPackageName(String packageName) {
		this.packageName = packageName;
	}

	@Override
	public int describeContents() {
		return 0;
	}

	@Override
	public void writeToParcel(Parcel dest, int flags) {
		dest.writeString(productID);
		dest.writeString(productName);
		dest.writeInt(productFlag);
		dest.writeInt(productType);
		dest.writeDouble(productPrice);
		dest.writeDouble(price);
		dest.writeString(SPID);
		dest.writeString(expiredTime);
		dest.writeInt(purchaseType);
		dest.writeString(changingPolicyDesc);
		dest.writeInt(subscriptionExtend);
		dest.writeString(serviceID);
		dest.writeString(transactionID);
		dest.writeInt(userIDType);
		dest.writeString(userId);
		dest.writeString(packageName);
	}

	public ProductInfo(Parcel source) {
		this.productID = source.readString();
		this.productName = source.readString();
		this.productFlag = source.readInt();
		this.productType = source.readInt();
		this.productPrice = source.readDouble();
		this.price = source.readDouble();
		this.SPID = source.readString();
		this.expiredTime = source.readString();
		this.purchaseType = source.readInt();
		this.changingPolicyDesc = source.readString();
		this.subscriptionExtend = source.readInt();
		this.serviceID = source.readString();
		this.transactionID = source.readString();
		this.userIDType = source.readInt();
		this.userId = source.readString();
		this.packageName = source.readString();
	}

	public static final Parcelable.Creator<ProductInfo>	CREATOR	= new Parcelable.Creator<ProductInfo>() {

																	@Override
																	public ProductInfo createFromParcel(Parcel source) {
																		return new ProductInfo(source);
																	}

																	@Override
																	public ProductInfo[] newArray(int size) {
																		return new ProductInfo[size];
																	}

																};

}
